package 字符串;

import java.util.ArrayList;
import java.util.Objects;

/**
 * @author yangjicong
 * @date 2022/1/19
 */
public class StringExercise {
	public static void main(String[] args) {

		stringLineTest();

	}


	/**
	 * 字符串换行测试
	 */
	public static void stringLineTest(){

		StringBuffer buffer = new StringBuffer();
		ArrayList<String> list = new ArrayList<>();
		String rowF = "\r\n";

		String phone = "11111111";
		String phone1 = "22222222";
		String phone2 = "33333333";
		String phone3 = "444444444";
		String phone4 = "55555555";
		list.add(phone);
		list.add(phone1);
		list.add(phone2);
		list.add(phone3);
		list.add(phone4);


		list.forEach(num->{
			buffer.append(num + rowF);
		});
		System.out.println( buffer);
		System.out.println("-----");

		//去除最后一个换行符
		StringBuffer bufferString = new StringBuffer(buffer.substring(0, buffer.length() - rowF.length()));
		System.out.println("bufferString = " + bufferString);
		System.out.println("------");

	}

	/**
	 * 工具类测试
	 */
	public static void utilsTest(){
		String ll = "wc";
		//ture  对象不为空
		boolean b = Objects.nonNull(ll);


	}
}
